﻿
namespace MyMenu.action
{
    public class ConfirmedAction : AbstractAction
    {
        public Action action
        {
            get;
            set;
        }

         private Action actionBack;

         public ConfirmedAction(Action action)
        {
            this.action = action;
        }

         public ConfirmedAction(Action action, Action actionBack)
         {
             this.action = action;
             this.actionBack = actionBack;
         }

         public override void execute()
         {
            if (GuiFactory.toGuiDialogYesNo(name))
            {
                action.execute();
            }
            else
            {
                if (actionBack != null)
                {
                    actionBack.execute();
                }
            }
        
        }
    }
}
